﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebClient.Models.ViewModels.GroupViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
		<% if (ViewData["OrderResult"] != null && ViewData["OrderResult"].ToString() != ""){ %>
			alert('<%= ViewData["OrderResult"].ToString() %>');
		<% } %>
	</script>
    <div id="content">
        <div id="container">
            <div id="div_float" style="width: 800px; padding-top: 20px;">
                <div id="div_cart">
                    <h1 class="h1"><b>Orders History</b></h1>
                    <table border="0" width="100%" cellspacing="0" cellpadding="0" style="background:#fff; font-size:11px; border: 1px #DBDBDB solid;">
                        <thead style="background-color: #F3F3F3; color: #FF0000; font-size: 15px;">
                            <tr>
                                <th>ID</th>
                                <th>Restaurant's Order</th>
                                <th>OrderDate</th>
                                <th>ShipDate</th>
			                    <th>IsVerified</th>
			                    <th>IsShipped</th>
			                    <th></th>
                            </tr>
                        </thead>
                        <tbody>
                        <% for (int i = 0; i < Model.OrdersModel.GetModel.LstObjModel.Count; i++)
                            { %>
                            <tr> 
                                <td style="text-align: center"><span style=""><%= Model.OrdersModel.GetModel.LstObjModel[i].ID %></span></td>
                                <td style="text-align: center"><span style=""><%= Model.OrdersModel.GetModel.LstObjModel[i].Restaurant.Name %></span></td>
			                    <td style="text-align: center"><span style=""><%= Model.OrdersModel.GetModel.LstObjModel[i].OrderDate %></span></td>
                                <td style="text-align: center"><span style=""><%= Model.OrdersModel.GetModel.LstObjModel[i].ShipDate %></span></td>
			                    <td style="text-align: center"><span style=""><%= Html.CheckBox("IsVerified", Model.OrdersModel.GetModel.LstObjModel[i].IsVerified, new { disabled = "disabled" })%></span></td>
			                    <td style="text-align: center"><span style=""><%= Html.CheckBox("IsShipped", Model.OrdersModel.GetModel.LstObjModel[i].IsShipped, new { disabled = "disabled" })%></span></td>
			                    <td style="text-align: center">
                                    <a href="../../Home/SelectOrderDetailByIDOrder?iduser=<%= Model.UsersModel.GetModel.LstObjModel[0].ID %>&idorder=<%= Model.OrdersModel.GetModel.LstObjModel[i].ID %>">
					                    <span style="">Select</span>
				                    </a>
			                    </td>
                            </tr>
                        <% } %>
                        </tbody>
                    </table>
                    <% if (Model.SelectedOrdersModel != null)
                       { %>
                       <%
                           var total = 0.0;
                           for (int i = 0; i < Model.OrderDetailModel.GetModel.LstObjModel.Count; i++)
                           {
                               total += (Model.OrderDetailModel.GetModel.LstObjModel[i].Quantity * Model.OrderDetailModel.GetModel.LstObjModel[i].Price);
                           }
                        %>
                        <br /><br />
                        <span style="font-size:18px; font-weight:bold;">Order <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].ID %></span>
                        <br />
                        <table class="AdminPageText">
                          <tr>
                            <td width="130" style="font-weight: bold;">Total:</td>
                            <td style="font-weight: bold; color: Red">
                                <%= Math.Round(total, 2) %> USD
                            </td>
                          </tr>
                          <tr>
                            <td width="130">IDCustomer:</td>
                            <td>
                                <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].User.ID %>
                            </td>
                          </tr>
                          <tr>
                            <td width="130">Customer:</td>
                            <td>
                                <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].User.Name %>
                            </td>
                          </tr>
                          <tr>
                            <td width="130">OrderDate:</td>
                            <td>
                                <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].OrderDate%>
                            </td>
                          </tr>
                          <tr>
                            <td width="130">ShipDate:</td>
                            <td>
                                <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].ShipDate%>
                            </td>
                          </tr>
                          <tr>
                            <td width="130">IsVerified:</td>
                            <td>
                                <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].IsVerified%>
                            </td>
                          </tr>
                          <tr>
                            <td width="130">IsShipped:</td>
                            <td>
                                <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].IsShipped%>
                            </td>
                          </tr>
                          <tr>
                            <td width="130">DeliveryNote:</td>
                            <td>
                                <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].DeliveryNote%>
                            </td>
                          </tr>
                          <tr>
                            <td width="130">Recever's Name:</td>
                            <td>
                                <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].ReceiverName%>
                            </td>
                          </tr>
                          <tr>
                            <td width="130">Recever's Address:</td>
                            <td>
                                <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].ReceiverAddress%>
                            </td>
                          </tr>
                          <tr>
                            <td width="130">Recever's Phone:</td>
                            <td>
                                <%= Model.SelectedOrdersModel.GetModel.LstObjModel[0].ReceiverPhone%>
                            </td>
                          </tr>
                        </table>
                        <br />
                        <div>
                        List Of Foods In Order
                        </div>
                        <table border="0" width="100%" cellspacing="0" cellpadding="0" style="background:#fff; font-size:11px; border: 1px #DBDBDB solid;">
	                        <thead style="background-color: #F3F3F3; color: #FF0000; font-size: 15px;">
		                        <tr>
			                        <th>No.</th>
                                    <th>Food</th>
                                    <th>Quantity</th>
			                        <th>Price</th>
		                        <tr>
	                        </thead>
	                    <% for (int i=0; i<Model.OrderDetailModel.GetModel.LstObjModel.Count; i++){
		                    if (i % 2 != 0) {%>
		                    <tr class="Row" id="Tr1">
		                    <% }
		                    else { %>
		                    <tr class="AlternatingRow" id="row-<%= Model.OrderDetailModel.GetModel.LstObjModel[i].ID %>">
		                    <% } %>
                                <td style="text-align: center"><span style=""><%= (i + 1) %></span></td>
                                <td style="text-align: center"><span style=""><%= Model.OrderDetailModel.GetModel.LstObjModel[i].Food.Name %></span></td>
			                    <td style="text-align: center"><span style=""><%= Model.OrderDetailModel.GetModel.LstObjModel[i].Quantity %></span></td>
			                    <td style="text-align: center"><span style=""><%= Model.OrderDetailModel.GetModel.LstObjModel[i].Price %> USD</span></td>
		                    </tr>
	                    <% } %>  
                    </table>
                    <% } %>
                </div>
            </div>
        </div>
    </div>
    <br />
</asp:Content>
